import { Component } from '@angular/core';

import {NavController, ToastController, LoadingController} from 'ionic-angular';
import {SearchService} from '../../../services/search.service';

import {FlashlightPage} from '../nativelist/flashlight/flashlight';
import {Cameras} from '../nativelist/camera/camera';




@Component({
  templateUrl: 'native-home.html',
  providers: [SearchService]
})
export class NativeHome {

  public movieHome:string;
  public movieHomeSub={
    "movie": [],
    "teleplay": []
  };
  items = [];
  constructor(
    public navCtrl: NavController,
    private toastCtrl: ToastController,
    public loadingCtrl: LoadingController,
    public searchService: SearchService,
  ) {
    // this.getMovieHome();
  }


  goFlashlightPage(){
    this.navCtrl.push(FlashlightPage);
  }

  goCamera(){
    this.navCtrl.push(Cameras);
  }

  public loading;

  showLoading(message) {
    this.loading = this.loadingCtrl.create({
      content: message,
      duration: 3000
    });
    this.loading.present();
  }

  hideLoading() {
    if (this.loading != null) {
      this.loading.dismissAll();
    }
  }

  showToast(message:string) {
    let toast = this.toastCtrl.create({
      message: message,
      duration: 3000,
      position: 'top'
    });

    toast.onDidDismiss(() => {
      console.log('Dismissed toast');
    });

    toast.present();
  }


}
